home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Reference Guide / C-C++ Interactive Reference Guide.iso / c_ref / csource2 / sclib_1 / 1_8 / v7n8013a.txt < prev    next >
Encoding:
Text File  |  1995-11-01  |  764 b   |  39 lines

  1. *****Listing 3*****
  2.  
  3.  
  4. #include <stdio.h>
  5.  
  6. void trace1(const char *filename, int line)
  7. {
  8.      static unsigned int counter = 0;
  9.  
  10.      ++counter;
  11.      fprintf(stderr, "T1 %3u: file: %s, line: %d\n",
  12.              counter, filename, line)
  13. {
  14.      static unsigned int counter = 0;
  15.  
  16.      ++counter;
  17.      fprintf(stderr, "T2 %3u: file: %s, line: %d\n\n",
  18.              counter, filename, line);
  19. }
  20.  
  21. The output produced from this version is:
  22.  
  23. T1> 1: file: t1l.c, line: 11
  24. inside f
  25. T2> 1: file: t1.c, line: 11
  26.  
  27. T1> 2: file: t1g.c, line: 7
  28. inside f
  29. T2> 2: file: t1g.c, line: 7
  30.  
  31. T1> 3: file: t1.c, line: 13
  32. inside f
  33. T2> 3: file: t1.c, line: 13
  34.  
  35. where T1 and T2 indicate the output from trace1 and trace2, respectively.
  36.  
  37.  
  38. *******************
  39.